package StudyCode.summary.Basic;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class PositiveInfinityNegativeInfinity {

	public static void main(String[] args) {
		System.out.println(Double.POSITIVE_INFINITY + "是不是正无穷大?" + isPositiveInfinity(Double.POSITIVE_INFINITY));
		System.out.println(100000 + "是不是正无穷大?" + isPositiveInfinity(100000));
		System.out.println(Double.NEGATIVE_INFINITY + "是不是负无穷大?" + isNegativeInfinity(Double.NEGATIVE_INFINITY));
		System.out.println(-100000 + "是不是负无穷大?" + isNegativeInfinity(-100000));
	}

	private static boolean isPositiveInfinity(double value) {
		return Double.compare(value, Double.POSITIVE_INFINITY) == 0;
	}

	private static boolean isNegativeInfinity(double value) {
		return Double.compare(value, Double.NEGATIVE_INFINITY) == 0;
	}

}
